package org.incubator.bean;

import org.incubator.Generator;
import org.springframework.beans.BeanUtils;

public class BeanGenerator<T> implements Generator<T> {
    private final Class<T> beanClass;

    public BeanGenerator(Class<T> beanClass) {
        this.beanClass = beanClass;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public T generate() {
        T bean = BeanUtils.instantiate(beanClass);
        // TODO: Randomize properties too, read JSR303 annotations for generator enhancement
        return bean;
    }
}
